package com.yootk;
import java.util.concurrent.CountDownLatch;

public class YootkDemo11 {
    public static void main(String[] args) throws Exception {
        CountDownLatch latch = new CountDownLatch(2);
        for (int x = 0; x < 2; x++) {
            new Thread(() -> {
                System.out.println("[" + Thread.currentThread().getName() + "] 到达");
                latch.countDown();
            }, "客人-" + x).start();
        }

        latch.await();
        System.out.println("【主线程】人齐了，开车走人。");
    }
}